var fs = require('fs')
window.onload = function(){
  var btn = this.document.querySelector('#btn')
  var myBody = this.document.querySelector('#myBody')
  btn.onclick = function(){
    fs.readFile('name.txt',(err,data)=>{
      if(err){
        console.log(err)
      }else{
        console.log('成功')
        myBody.innerHTML = data
      }
    })
  }
}